package com.runa.monitor.platinterface.mqtt;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class EmqConfig {

    private static String userName;

    private static String passWord;

    private static String HOST;

    private static String httpServer;
    private static String httpUserName;
    private static String httpPassWord;

    private static Integer timeout;

    private static Integer keepalive;

    private static Integer consumerClients;

    private static Integer publisherClients;

    private static Integer maxInFlightCount;

    private static Integer scheduleQueueCount;


    public static String getHttpUserName() {
        return httpUserName;
    }

    @Value("${storm-mqtt.httpUserName:admin}")
    public void setHttpUserName(String httpUserName) {
        EmqConfig.httpUserName = httpUserName;
    }

    public static String getHttpPassWord() {
        return httpPassWord;
    }

    @Value("${storm-mqtt.httpPassWord:public}")
    public void setHttpPassWord(String httpPassWord) {
        EmqConfig.httpPassWord = httpPassWord;
    }

    public static Integer getScheduleQueueCount() {
        return scheduleQueueCount;
    }

    @Value("${storm-mqtt.schedule.queue.count:3000}")
    public void setScheduleQueueCount(Integer scheduleQueueCount) {
        EmqConfig.scheduleQueueCount = scheduleQueueCount;
    }

    public static Integer getMaxInFlightCount() {
        return maxInFlightCount;
    }

    @Value("${storm-mqtt.max.inflight.count:3200}")
    public void setMaxInFlightCount(Integer maxInFlightCount) {
        EmqConfig.maxInFlightCount = maxInFlightCount;
    }

    public static Integer getConsumerClients() {
        return consumerClients;
    }

    @Value("${storm-mqtt.consumer.client.count:1}")
    public void setConsumerClients(Integer consumerClients) {
        EmqConfig.consumerClients = consumerClients;
    }

    public static Integer getPublisherClients() {
        return publisherClients;
    }

    @Value("${storm-mqtt.publisher.client.count:1}")
    public void setPublisherClients(Integer publisherClients) {
        EmqConfig.publisherClients = publisherClients;
    }

    @Value("${storm-mqtt.username}")
    public void setUserName(String userName) {
        EmqConfig.userName = userName;
    }

    public static String getUserName() {
        return userName;
    }

    @Value("${storm-mqtt.password}")
    public void setPassWord(String passWord) {
        EmqConfig.passWord = passWord;
    }

    public static String getPassWord() {
        return passWord;
    }

    @Value("${storm-mqtt.serverURIs}")
    public void setHOST(String HOST) {
        EmqConfig.HOST = HOST;
    }

    public static String getHOST() {
        return HOST;
    }

    public static String getHttpServer() {
        return httpServer;
    }

    @Value("${storm-mqtt.httpServer}")
    public void setHttpServer(String httpServer) {
        EmqConfig.httpServer = httpServer;
    }

    @Value("${storm-mqtt.timeout}")
    public void setTimeout(Integer timeout) {
        EmqConfig.timeout = timeout;
    }


    public static Integer getTimeout() {
        return timeout;
    }

    @Value("${storm-mqtt.keepalive}")
    public void setKeepalive(Integer keepalive) {
        EmqConfig.keepalive = keepalive;
    }


    public static Integer getKeepalive() {
        return keepalive;
    }
}
